﻿Imports System.Data.OleDb
Public Class rest_review_list
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_Comment_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_Comment.Click
        Dim sql As String = "INSERT INTO Comments (Author,Title,CommentBody,Restaurant_fkid) VALUES (@f1,@f2,@f3,f4)"
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)

        cmd.Parameters.AddWithValue("@f1", User.Identity.Name)
        cmd.Parameters.AddWithValue("@f2", tb_Title.Text)
        cmd.Parameters.AddWithValue("@f3", tb_CommentBody.Text)
        cmd.Parameters.AddWithValue("@f4", Request.QueryString("ID"))

        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Response.Redirect("ReviewList.aspx?ID=" & Request.QueryString("ID"))


    End Sub
End Class